<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page session="false" contentType="text/html; charset=UTF-8"%>
<c:set var="_CONTEXTPATH"></c:set>

<html>
<head>

	<title>Home</title>
</head>
<style>
.btn{
	width:50px;
	border-style: solid;
	border-width: 2px;
}
</style>
<script></script>

<script src="/platform/js/jquery-1.9.1.min.js">
</script>
<body>
<h1>
	Hello world!  
</h1>

<P>  The time on the server is ${serverTime}. </P>
<table>
<c:set var="no" value="0"></c:set>
<c:forEach var="line" begin="0" end="3">
	<tr>
		<c:forEach var="kan" begin="0" end="2">
			<c:choose>
				<c:when test="${no<9}">
					<c:set var="no" value="${no+1}"/>
					<td class="btn" name="btn${no}">${no}</td>
				</c:when>
				<c:otherwise>
					<c:set var="no" value="${no+1}"/>
					<c:choose>
						<c:when test="${no==10}">
							<td class="btn" name="btn${no%10}">${no%10}</td>
						</c:when>
						<c:when test="${no==11}">
							<td colspan="2" id="btnEql" class="btn" name="btnEql">=</td>
						</c:when>
					</c:choose>
				</c:otherwise>			
			</c:choose>
		</c:forEach>
		<c:choose>
			<c:when test="${line==0}">
				<td class="btn" name="btnAdd">+</td>
			</c:when>
			<c:when test="${line==1}">
				<td class="btn" name="btnMinu">-</td>
			</c:when>
			<c:when test="${line==2}">
				<td class="btn" name="btnDiv">/</td>
			</c:when>
			<c:when test="${line==3}">
				<td class="btn" name="btnMul">*</td>
			</c:when>
		</c:choose>
	</tr>
</c:forEach>

<tr>
	<td colspan="4"><input type="text" name="inputBox" id="inputBox"></td>
</tr>
<tr>
	
</tr>

<a href="http://www.naver.com">네이버</a>
</table>


</body>

<script>


$('td[name^="btn"]').click(function(){
	var text1 = $(this).text();
	
	var tmp = $("#inputBox").val();
	if(text1 != "="){
		$("#inputBox").val(tmp + text1);	
	}
	
});

 $("#btnEql").click(function(){
		alert("call");
		
	$.ajax({
		
		url : "http://localhost:8080/platform/bb",
		type : "post",
		data : $("#inputBox").serialize()
		
		
	});
}); 



</script>
</html>
